const obj = {
  name: "xjh",
  age: 10,
};

// objProxy 上所有的操作,都会在 obj中更改
const objProxy = new Proxy(obj, {
  get: function (target, key) {
    console.log("get", target[key]);
    return target[key];
  },
  // 设置
  set: function (target, key, newValue) {
    console.log("set", newValue);
    target[key] = newValue;
  },

  // 监听 in 的捕获器
  has(target, key) {},

  deleteProperty(target, key) {},
});

// objProxy.age = 31;
console.log(objProxy.age);
